package cn.wolfcode.service.impl;

import cn.wolfcode.domain.Classinfo;
import cn.wolfcode.mapper.ClassinfoMapper;
import cn.wolfcode.quest.ClassinfoQueryObject;
import cn.wolfcode.service.IClassinfoService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ClassinfoServiceImpl implements IClassinfoService {
     @Autowired
     private ClassinfoMapper classinfoMapper;


    @Override
    public void deleteById(Long id) {
          classinfoMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void insert(Classinfo emp) {
           classinfoMapper.insert(emp);
    }

    @Override
    public Classinfo get(Long id) {
        return classinfoMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Classinfo> selectAll() {
        return classinfoMapper.selectAll();
    }

    @Override
    public void update(Classinfo emp) {
           classinfoMapper.updateByPrimaryKey(emp);
    }

    @Override
    public PageInfo<Classinfo> query(ClassinfoQueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<Classinfo> list=classinfoMapper.selectList(qo);
        return new PageInfo<>(list);
    }
}
